package ventanas;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridBagLayout;
import java.awt.GridLayout;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

public class Publicidad extends JPanel {
	ImageIcon  imagen;

	/**
	 * Create the panel.
	 */
	public Publicidad(String nombre) {
		super();
		initialize();
		 imagen = new ImageIcon(getClass().getResource(nombre));
		 setSize(imagen.getIconWidth(),imagen.getIconHeight());
	}

	private void initialize() {
		 this.setSize(300,200);
		 this.setLayout(new GridBagLayout());
		
	}
 protected void paintComponent(Graphics g){
	 Dimension d= getSize();
	 g.drawImage(imagen.getImage(), 0, 0, d.width, d.height, null);
	 this.setOpaque(false);
	 super.paintComponents(g);
 }
}
